﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SisLegal.Maestros
{
    public partial class LawyerNewForm : System.Web.UI.Page
    {
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.LawyerManager typeProcessManager = new Model.LawyerManager();
            Model.Lawyer lawyer = new Model.Lawyer();
            lawyer.Name = txtName.Text;
            lawyer.Fono = txtFono.Text;
            lawyer.Email = txtEmail.Text;
            lawyer.Address = txtAddress.Text;
            int newArticleID = typeProcessManager.Save(lawyer);

            if (newArticleID != 0)
            {
                lblConfirmation.Text = "Grabado Satifactoriamente";
                lblConfirmation.Visible = true;
            }
            else
            {
                lblConfirmation.Text = "Error en la Grabacion";
                lblConfirmation.Visible = true;
            }

            ClearForm();
        }

        private void ClearForm()
        {
            txtName.Text = String.Empty;
        }
    }
}